<?php
include "includes/connection.php";
include "includes/article.php";

$article = new Article;
$articles = $article->fetch_all();


?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>CMS</title>
    <link rel="stylesheet" href="assets/style.css" media="all">
</head>
<body>
    <div class="container">
        <a id="logo" href="index.php">CMS</a>
        
        <ol>
            <?php foreach ($articles as $article ) { ?>
                    <li>
                    <a href="article.php?id=<?php echo $article["article_id"]; ?>">
                        <?php echo $article["article_title"]; ?></a>
                    - <small>
                        posted <?php echo date("l jS", $article["article_timestamp"]); ?></small>
                    
                    </li>
            <?php } ?>
        </ol>
        <br>
        <small><a href="admin">Admin</a></small>
    </div>
    
</body>
</html>
